<?
set_time_limit(6000);
$_ISA_LDAP_HOST = "192.168.9.123";			 // Dia chi ldap servers
$_ISA_LDAP_PORT = 389;
$ldap_conn = ldap_connect($_ISA_LDAP_HOST,$_ISA_LDAP_PORT) or die( "Loi ket noi voi LDAP Server: " );
ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3);
$bind_result  = ldap_bind($ldap_conn, "administrator@isa.com.vn", "xuanchuong");

$base_dn = "CN=Users,DC=isa,DC=com,DC=vn"; 

$filter="objectcategory=*";
$sr=ldap_search($ldap_conn,$base_dn,$filter);
$ldapResults = ldap_get_entries($ldap_conn, $sr);
echo "total:".$ldapResults['count']."<br>";
for ($item = 0; $item < $ldapResults['count']; $item++)
{
  for ($attribute = 0; $attribute < $ldapResults[$item]['count']; $attribute++)
  {
   $data = $ldapResults[$item][$attribute];
   echo $data.":&nbsp;&nbsp;".$ldapResults[$item][$data][0]."<br>";
  }
  echo '<hr />';
}

?>